<template>
  <div>
    <a-descriptions bordered size='small' :column='4' title='发货单信息'>
      <a-descriptions-item label='订单编号'>
        <span v-clipboard:copy='orderForm.orderNo' v-clipboard:success='onCopy' style='cursor:pointer'>{{ orderForm.orderNo }}</span>
      </a-descriptions-item>
      <a-descriptions-item label='发货单号'>
        <span v-clipboard:copy='orderForm.outOrderNo' v-clipboard:success='onCopy' style='cursor:pointer'>{{ orderForm.outOrderNo }}</span>
      </a-descriptions-item>
      <a-descriptions-item label='制单日期'>
        {{ orderForm.createDate }}
      </a-descriptions-item>
      <a-descriptions-item label='发货日期'>
        {{ orderForm.sendDate }}
      </a-descriptions-item>
      <a-descriptions-item label='部门'>
        {{ orderForm.deptName }}
      </a-descriptions-item>
      <a-descriptions-item label='业务员'>
        <span v-clipboard:copy='orderForm.saleManName' v-clipboard:success='onCopy' style='cursor:pointer'>{{ orderForm.saleManName }}</span>
      </a-descriptions-item>
      <a-descriptions-item label='业务编码'>
        <span v-clipboard:copy='orderForm.businessCode' v-clipboard:success='onCopy' style='cursor:pointer'>{{ orderForm.businessCode }}</span>
      </a-descriptions-item>
      <a-descriptions-item label='结算关系'>
        {{ orderForm.saleManNameD }} {{orderForm.saleManNameC}} {{orderForm.saleManNameE}}
      </a-descriptions-item>
      <a-descriptions-item label='发货区域'>
        {{ orderForm.sendArea }}
      </a-descriptions-item>
      <a-descriptions-item label='单位名称'>
        <span v-clipboard:copy='orderForm.customName' v-clipboard:success='onCopy' style='cursor:pointer'>{{ orderForm.customName }}</span>
      </a-descriptions-item>
      <a-descriptions-item label='发货方式'>
        <a-tag color='purple' v-if='orderForm.sendType==1'>全款</a-tag>
        <a-tag color='purple' v-if='orderForm.sendType==2'>预付款</a-tag>
        <a-tag color='purple' v-if='orderForm.sendType==3'>资保金</a-tag>
        <a-tag color='purple' v-if='orderForm.sendType==4'>全额资信</a-tag>
      </a-descriptions-item>
      
      <a-descriptions-item label='购方资信' v-if='orderForm.sendType==3'>
        <a-tag color='purple' v-if='orderForm.customBondType==1'>底价</a-tag>
        <a-tag color='purple' v-if='orderForm.customBondType==2'>税金</a-tag>
        <a-tag color='purple' v-if='orderForm.customBondType==3'>底价+税金</a-tag>
      </a-descriptions-item>

      <a-descriptions-item label='订单状态'>
        <a-tag color='#87d068' v-if='orderForm.orderState==0'>未提交</a-tag>
        <a-tag color='#87d068' v-if='orderForm.orderState==1'>{{ orderForm.taskName }}</a-tag>
        <a-tag color='#f50' v-if='orderForm.orderState==2'>已审批</a-tag>
      </a-descriptions-item>


      <a-descriptions-item label='收货人'>
        {{ orderForm.customUserName }}
      </a-descriptions-item>
      <a-descriptions-item label='联系方式'>
        {{ orderForm.customUserTel }}
      </a-descriptions-item>
      <a-descriptions-item label='收货地址' :span='2'>
        <f-elipsis :text='orderForm.customAddress' :length='50'></f-elipsis>
      </a-descriptions-item>
      <a-descriptions-item label='附件' :span='2'>
        <f-images :value='orderForm.orderImage'></f-images>
      </a-descriptions-item>
      <a-descriptions-item label='开票要求' :span='2'>
        {{ orderForm.invoiceRemark }}
      </a-descriptions-item>
      <a-descriptions-item label='随货资料' :span='2'>
        <f-elipsis :text='orderForm.sendRemark' :length='50'></f-elipsis>
      </a-descriptions-item>
      <a-descriptions-item label='审批备注' :span='2'>
        <f-elipsis :text='orderForm.applyRemark' :length='50'></f-elipsis>
      </a-descriptions-item>
      <a-descriptions-item label='备注' :span='2'>
        {{ orderForm.remark }}
      </a-descriptions-item>
    </a-descriptions>
    <a-divider orientation='left' v-if='returnList&& returnList.length>0'>认款信息</a-divider>
    <f-table ref='returnDetails' :tableColumns='returnColumns' setting-key='hy_order_tab2_details' rowKey='paymentId' :scroll='{x:true}' :params='queryParam' :dataSource='returnList' :showPagination='false' :multiple='false' v-if='returnList&& returnList.length>0'>

    </f-table>
  </div>
</template>

<script>
import api from "../../js/api"
import { processMixins } from "@/core/mixins/processMixins"

export default {
  name: "hyOrderDescriptions",
  components: {},
  mixins: [processMixins],
  props: {
    orderId: {
      type: String,
      default: null
    }
  },
  data() {
    let me = this
    //操作按钮
    let operator = []
    return {
      api: Object.assign(api, this.api),
      //列表初始化查询参数
      queryParam: {},
      returnList: [],
      orderForm: {},
      operator: operator,
      returnColumns: [{
        title: "流水号",
        align: "center",
        dataIndex: "bankStatementId"
      },{
        title: "回款单位",
        align: "center",
        dataIndex: "customName"
      }, {
        title: "回款银行",
        align: "center",
        dataIndex: "returnBank"
      }, {
        title: "回款账户",
        align: "center",
        dataIndex: "returnBankNo"
      }, {
        title: "回款金额",
        align: "center",
        dataIndex: "returnAmount"
      }, {
        title: "使用金额",
        align: "center",
        dataIndex: "useAmount"
      }, {
        title: "回款日期",
        align: "center",
        dataIndex: "returnDate"
      }, {
        title: "备注",
        align: "center",
        dataIndex: "remark"
      }]
    }
  },
  created() {
    this.setData(this.orderId)
  },
  computed: {},
  methods: {
    setData(orderId) {
      if (orderId) {
        let params = {
          orderId: orderId,
          handlerName: "hyOrderGetHandler"
        }
        this.http.get(this, {
          url: this.api.hyorder.get,
          params: params,
          success: (me, data) => {
            this.orderForm = data
            this.returnList = data.returnList
            this.loaded = true
          }
        })
      }
    },
    handleSuccess() {
      this.$emit("success")
    }
  }
}
</script>